const router = require('koa-router')()
const Mock = require('mockjs')
const { list } = Mock.mock({
  "list|30": [{
    "title|1": ["北京会议室1","北京会议室2","北京会议室3"],
    "desc": "@cword(10, 20)",
    "count|1": ["2", '4', '10'],
    "id": "@id",
    "image": "@image(150x150, @color)"
  }]
})
router.get('/list', ctx => {
  const { title, count } = ctx.request.query;
  const newList = list.filter(v => {
    if(title) return v.title === title
    return true
  }).filter(v => {
    if(count) return v.count === count;
    return true
  })
  ctx.body = {
    code: 200,
    data: newList
  }
})
module.exports = router
